<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/include/global.jsp"%>
<%@page import="java.net.URLEncoder"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>用户管理</title>
<jsp:include page="/include/headqui.jsp" />
<jsp:include page="/include/popmessage.jsp" />
<script type="text/javascript">
	function doSubmit() {	
		jQuery("#userbrowseId").submit();
	}
	 
</script>
</head>
<body>
<div id="scrollContent" class="border_gray">
 	<form id ="userbrowseId" action="${pageContext.request.contextPath}/admin/ugr/user_browse.jspa" method="post" >
	<div class="box2" panelTitle="用户管理" statusText="" roller="false">
		<div class="box_tool_mid  padding_right5 ">
			<div class="center">
			<div class="left">
			<div class="right">
				<div class="padding_top5 padding_left10">
				<table>
					<tr>
						<td>查询:&nbsp;&nbsp;登录名</td>
						<td><input type="text" name="txtname" size="5" value="${txtname}"/></td>
						<td>&nbsp;&nbsp;用户名</td>
						<td><input type="text" name="queryFullName" size="10" value="${queryFullName}"/></td>
						<td><button onclick="doSubmit();"><span class="icon_find">查询</span></button></td>
					</tr>
				</table>
				</div>			
			</div>		
			</div>	
			</div>
			<div class="clear"></div>
		</div>
	</div>
	<div class="box_tool_min padding_top2 padding_bottom2 padding_right8">
		<div class="center">
		<div class="left">
		<div class="right">
			<div class="padding_top5 padding_left10">
			<a href="${pageContext.request.contextPath}/admin/ugr/user_preCreate.jspa?page=${users.page}"><span class="icon_add">新增用户</span></a>
			<div class="box_tool_line"></div>
			<div class="clear"></div>
			</div>
		</div>		
		</div>	
		</div>
		<div class="clear"></div>
	</div>
	<div class="margin_right8">
		<table class="tableStyle">
			<tr>
				<th scope="col" width="2%">序号</th>
				<th scope="col" width="5%">登录名</th>
				<th scope="col" width="5%">初始密码</th>
				<th scope="col" width="20%">用户名</th>
				<th scope="col" width="15%">单位</th>
				<th scope="col" width="5%">联系人</th>
				<th scope="col" width="5%">用户排序</th>	
				<th scope="col" width="5%">状态</th>					 
				<th scope="col" width="10%">操作</th>
			</tr>			
	 		 <c:forEach var="user" items="${users.results}" varStatus="status">
				<tr <c:if test="${(status.count % 2) eq 0 }">class="odd"</c:if>  >
					<td class="ali02" scope="row">${(users.page-1)*users.pageSize +status.count}</td>
					<td>${user.username}</td>
					<td>${user.plainPassword}</td>
					<td>${user.fullname}</td>
					<td>${user.dept.name}</td>
					<td>${user.linkmen}</td>
					<td>${user.userOrder}</td>
					<td><c:choose>
							<c:when test="${user.enabled}">可用</c:when>
   							<c:otherwise>不可用</c:otherwise>
						</c:choose>
					</td>
					<td class="ali02">
						<a class="blue underLine " href="${pageContext.request.contextPath}/admin/ugr/user_edit.jspa?id=${user.id}&page=${users.page}">修改</a>┆
						<a class="red underLine " href="${pageContext.request.contextPath}/admin/ugr/user_delete.jspa?id=${user.id}&page=${users.page}" onclick="return confirm('确定要删除当前用户吗?');">删除</a>┆
						
						<c:if test="${user.enabled eq true}">
							<a class="gray underLine " href="${pageContext.request.contextPath}/admin/ugr/user_delete.jspa?id=${user.id}&page=${users.page}&cate=logic" onclick="return confirm('确定要逻辑删除当前用户吗?');">禁用</a>
						</c:if>
						<c:if test="${user.enabled eq false}">
							<a class="blue underLine " href="${pageContext.request.contextPath}/admin/ugr/user_delete.jspa?id=${user.id}&page=${users.page}&cate=logic" onclick="return confirm('确定要恢复 当前用户吗?');">启用</a>
						</c:if>
					
					</td>
				</tr>
			 </c:forEach>
		</table>
	</div>
	<%
							String txtname = (String)request.getAttribute("txtname");
							
							if(StringUtils.isNotBlank(txtname)){
								txtname = URLEncoder.encode(txtname,"utf8");
								request.setAttribute("txtname", txtname);
							}
						%>	
	<div style="height:35px;">
		<div class="float_left padding5">
		</div>
		<div class="float_right margin_top5 margin_right50 paging">
			<pagination:paginator url="/admin/ugr/user_browse.jspa?txtname=${txtname}&queryFullName=${queryFullName}&queryUnit=${queryUnit}" page="${users}" style="style1"></pagination:paginator>
		</div>
		<div class="clear"></div>
	</div>
	</form>
</div>
</body>
</html>	  
